//
//  UIBarButtonItem+Externsion.swift
//  Sina
//
//  Created by 星仔 on 2017/2/27.
//  Copyright © 2017年 xingZai. All rights reserved.
//

import UIKit

extension UIBarButtonItem {
    
    convenience init(title:String,target:AnyObject?,action:Selector,isBack:Bool) {
        let button = UIButton()
        button.setTitle(title, for: .normal)
        if isBack {
            button.setImage(UIImage(named:"navigationbar_back_withtext"), for: .normal)
            button.setImage(UIImage(named:"navigationbar_back_withtext_highlighted"), for: .highlighted)
            button.sizeToFit()
        }
        button.setTitleColor(UIColor.black, for: .normal)
        button.addTarget(target, action: action, for: .touchUpInside)
        self.init(customView:button)
        button.sizeToFit()
    }
}


